package demoMod.stsconsole.cards.red;

import demoMod.stsconsole.cards.AbstractCard;
import demoMod.stsconsole.characters.AbstractPlayer;
import demoMod.stsconsole.core.AbstractCreature;
import demoMod.stsconsole.utils.CardSelect;

import java.util.List;

public class Exhume extends AbstractCard {
    public static final String ID = "Exhume";

    public Exhume() {
        super(ID);
        this.color = CardColor.RED;
        this.cost = 1;
        this.rarity = CardRarity.RARE;
        this.type = CardType.SKILL;
        this.target = CardTarget.SELF;
        this.exhaust = true;
    }

    @Override
    public void upgrade() {
        if (!this.upgraded) {
            this.upgraded = true;
            this.name = this.name + "+";
            this.upgradeTimes++;
            this.cost = 0;
        }
    }

    @Override
    public boolean use(AbstractPlayer p, AbstractCreature target) {
        List<AbstractCard> cards = CardSelect.selectCards(p.exhaustPile, 1, card -> !card.id.equals(ID), false);
        if (!cards.isEmpty()) {
            p.exhaustPile.remove(cards.get(0));
            p.makeTempCardsInHand(cards.get(0), 1);
        }
        return true;
    }
}
